package com.example.web;

import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class BeerSelect extends HttpServlet{
	public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException{
		String c = request.getParameter("color");
		BeerExpert be = new BeerExpert();
		List result = be.getBrands(c);
		
		//response.setContentType("text/html");
		//PrintWriter out = response.getWriter();
		//out.println("Beer Selection Advice<br>");
		
		//Iterator it=result.iterator();
		//while(it.hasNext())
		//	out.println("<br>try: "+it.next());
		
		request.setAttribute("styles",result);	//为请求对象增加一个属性，供jsp使用
		
		RequestDispatcher view = request.getRequestDispatcher("result.jsp");	//为JSP实例化一个请求分配器
		
		view.forward(request,response);	//向jsp发送请求和响应
	}

}